import { BASE_URI } from "@/utils/const";
import request from '@/utils/request.js'
const ADMIN_BASE_URL = '/admin'
export default {
    getAdminList(queryAdminDto){
        return request({
            url: BASE_URI + ADMIN_BASE_URL + '/list',
            data:{
                "page_no":queryAdminDto.pageNo,
                "page_size":queryAdminDto.pageSize,
                "admin_account":queryAdminDto.adminAccount,
                "admin_name":queryAdminDto.adminName,
                "admin_phone":queryAdminDto.adminPhone
            },
            method: 'post'
        })
    },
    updateAdmin(adminDto){
        return request({
            url: BASE_URI + ADMIN_BASE_URL + '/update',
            data:{
                "admin_account":adminDto.adminAccount,
                "admin_name":adminDto.adminName,
                "admin_age":adminDto.adminAge,
                "admin_sex":adminDto.currAdminSex,
                "admin_role":adminDto.currAdminRole,
                "admin_phone":adminDto.adminPhone,
                "id":adminDto.id
            },
            method: 'post'
        })
    },
    saveAdmin(adminDto){
        return request({
            url: BASE_URI + ADMIN_BASE_URL + '/save',
            data:{
                "admin_account":adminDto.adminAccount,
                "admin_name":adminDto.adminName,
                "admin_age":adminDto.adminAge,
                "admin_sex":adminDto.currAdminSex,
                "admin_role":adminDto.currAdminRole,
                "admin_phone":adminDto.adminPhone
            },
            method: 'post'
        })
    },
    removeAdmin(id){
        return request({
            url: BASE_URI + ADMIN_BASE_URL + '/remove',
            params:{"id":id}, //以表单格式请求时，用params；以Json格式请求时，用data
            method: 'post'
        })
    }
}
